package com.testpro.DesignPattern.FactoryPattern;

public class CacheCarFactoryTest {
    public static void main(String[] args) {
        CacheCarFactory cacheCarFactory= new CacheCarFactory();

        Car car = cacheCarFactory.getnewCar();
        Car oldCar = cacheCarFactory.getOldCar();
        Car newCar = cacheCarFactory.getInstanceForString("newCar");
        Car oldCar1 = cacheCarFactory.getInstanceForString("oldCar");
        Car msld = cacheCarFactory.getInstanceForString("来一个玛莎拉蒂");
        System.out.println(car==newCar);
        System.out.println(oldCar==oldCar1);
        System.out.println(car==msld);
        System.out.println(oldCar1==msld);
    }
}
